<?php


namespace modules\sys\service\impl;


use application\core\Result;
use modules\sys\mapper\MysqlMapper;
use modules\sys\service\AjaxService;

class AjaxServiceImpl implements AjaxService
{

    function tableEdit(array $data): array
    {
        $tableName = $data['table_name'];
        $id = $data['id'];
        $fieldName = $data['field_name'];
//        $value = $data['value'];
        if (empty($tableName) || empty($fieldName) || empty($id)) {
            return Result::fail(false, "", "修改失败，参数不完整");
        }
        $tableEdit = MysqlMapper::tableEdit($data);
        if ($tableEdit == 0) {
            return Result::fail(false, "", "数据未改变");
        }
        return Result::success(true, "", "操作成功");
    }
}